<%--
  Created by IntelliJ IDEA.
  User: Dell
  Date: 2021/11/16
  Time: 10:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String path = request.getContextPath();%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />

    <link rel="stylesheet" href="<%=path %>/web/index/css/font.css">
    <link rel="stylesheet" href="<%=path %>/web/index/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="<%=path %>/web/index/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=path %>/web/index/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <script type="text/javascript">
        function check_form(){
            var cardid = document.getElementById("cardid").value;
            var tel = document.getElementById("tel").value;

            var rsg = /(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)/;



            if(cardid==""){
                alert("系统提示：填写不规范（身份证号 不能为空！请检查……）");
                return false;
            }

            /*if(!rsg.test(cardid)){
                alert("系统提示：填写不规范（身份证号 填写不正确！请检查……）");
                return false;
            }*/


            if(tel==""){
                alert("系统提示：填写不规范（联系方式 不能为空！请检查……）");
                return false;
            }

        }
        function returnfor(){
            window.location.href = "sys_managers_view";
        }

        function check_msg(){
            var msg = '${b}';
            if(msg=="true"){
                alert("系统提示：创建数据成功！即将返回列表……");
                returnfor();
            }if(msg=="false"){
                alert("系统提示：创建数据失败！请检查……");
            }
        }

    </script>

    <script type="text/javascript">
        function doCardid(v){
            var pre_sex = "";
            var pre_age = "";
            if(v.length==18){
                var sex = v.substring(16,17);//220282166602125933
                if(sex%2==0){
                    pre_sex = "女";
                }else{
                    pre_sex = "男";
                }
                var age = v.substring(6,10);
                var date=new Date;
                var now_year = date.getFullYear();
                pre_age = now_year-age;
            }



            document.getElementById("age").value = pre_age;
            document.getElementById("sex").value = pre_sex;


        }

    </script>



</head>

<body onload="check_msg()">
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">员工信息管理</a>
        <a>
          <cite>员工信息修改</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <h1 ><strong style="font-size: 25px;">员工信息修改</strong></h1>
    <form action="sys_managers_update" method="post" onsubmit="return check_form()">
        <input type="hidden" name="id" id="id"  autocomplete="off" value="${s.id}" class="layui-input"/>

        <table class="layui-table">

            <tr>
                <th style="text-align: right;">真实姓名：</th>
                <td style="width: 200px;"><input type="text" name="username" id="username"  autocomplete="off"  value="${s.username}" class="layui-input"/></td>
                <td style="color: red;"></td>
            </tr>

            <tr>
                <th style="text-align: right;">身份证号：</th>
                <td style="width: 200px;"><input type="text" name="cardid" id="cardid"  autocomplete="off" value="${s.cardid}" class="layui-input" onkeyup="doCardid(this.value)"/></td>
                <td style="color: red;">*必填项</td>
            </tr>

            <tr>
                <th style="text-align: right;">年龄：</th>
                <td style="width: 200px;"><input type="text" name="age" id="age"  autocomplete="off" value="${s.age}" class="layui-input" readonly="readonly"/></td>
                <td style="color: red;">*此项无需手动添加数据</td>
            </tr>

            <tr>
                <th style="text-align: right;">性别：</th>
                <td style="width: 200px;"><input type="text" name="sex" id="sex"  autocomplete="off" value="${s.sex}" class="layui-input" readonly="readonly"/></td>
                <td style="color: red;">*此项无需手动添加数据</td>
            </tr>

            <tr>
                <th style="text-align: right;">联系方式：</th>
                <td style="width: 200px;"><input type="text" name="tel" id="tel"  autocomplete="off" value="${s.tel}" class="layui-input"/></td>
                <td style="color: red;">*必填项</td>
            </tr>



            <tr>
                <th style="text-align: right;">状态：</th>
                <td style="width: 200px;">
                    <select name="flag" id="flag" >
                        <c:if test="${s.flag == '0'}"><option value="0">开启</option></c:if>
                        <c:if test="${s.flag == '1'}"><option value="1">关闭</option></c:if>
                        <option value="0">开启</option>
                        <option value="1">关闭</option>
                    </select>
                </td>
                <td style="color: red;"></td>
            </tr>


            <tr>
                <td colspan="3" style="text-align: center;">
                    <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="submit">信息修改</button>
                    <button onclick="returnfor()" class="layui-btn"  lay-submit="" lay-filter="sreach" type="button" style="background-color: indianred;"> 返 回 </button>
                </td>
            </tr>

        </table>
    </form>
</div>

</body>

</html>
